﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HalconDotNet;
namespace HalconAssit
{
    /// <summary>
    /// 变量定义类
    /// </summary>
    public class ClsVar
    {
        public HObject Data = null;
        public HTuple DataHTupe = null;
        public string Color = "red";
        public string RegionDrawMode = "margin";
        public string Name = string.Empty;
        public enumVarType VarType = enumVarType.UNDEF;
        public ClsVar(HRegion hRegion)
        {
            Data = hRegion;
            VarType = enumVarType.REGION;
        }
        public ClsVar(HImage himage)
        {
            Data = himage;
            VarType = enumVarType.IMG;
        }
        public ClsVar(HXLD hxld)
        {
            Data = hxld;
            VarType = enumVarType.XLD;
        }

        public ClsVar(HTuple hTuple)
        {
            DataHTupe = hTuple;
            if (hTuple.Type == HTupleType.HANDLE)
            {
                VarType = enumVarType.TUPLE3D;
            }
            else
            {
                VarType = enumVarType.TUPLE;
            }

        }
        public ClsVar(ClsVar clsVar)
        {
            this.Data = clsVar.Data;
            this.DataHTupe = clsVar.DataHTupe;
            this.Color = clsVar.Color;
            this.RegionDrawMode = clsVar.RegionDrawMode;
            this.Name = clsVar.Name;
            this.VarType = clsVar.VarType;

        }
        public ClsVar()
        {
            HOperatorSet.GenEmptyObj(out Data);
            VarType = enumVarType.EMPTY;

        }
    }


    public enum enumVarType
    {
        UNDEF = 0,
        IMG = 1,
        REGION,
        XLD,
        TUPLE,
        TUPLE3D,
        EMPTY,//空

    }
}
